package org.bultreebank.search_engine;


public interface SearchEngine {
	/**
	 * Returns an array of the configured indexing analyzers for
	 * each natural language
	 * @return
	 */
	public String[] getIndexAnalyzerLanguages();
	/**
	 * Returns an array of the configured search analyzers for
	 * each natural language
	 * @return
	 */
	public String[] getSearchAnalyzerLanguages();
	/**
	 * Sets in the indexing process a document that is a report of
	 * the indexing process 
	 * @param reportDoc - an empty report doc
	 */
	public void setIndexingReportDocument()throws Exception;
	
	/**
	 * Adds the XML document to the index and the document repository if
	 * it exists.
	 * @param xmlDocument - XML document to index
	 * @param metadataDocument - additional data for the XML document to 
	 * index
	 * @param index - user defined index ID
	 * @param docID - an explicitly defined doc ID
	 * @throws Exception
	 */
	public void  indexDocument(
			String xmlDocument, String metadataDocument, String indexID, 
			String docID, boolean returnReport)
	throws Exception;

	/**
	 * Adds the document with the specified document ID to the specified index
	 * @param docID - document ID of a document available in the Search
	 *  Engine Document Repository if it exists 
	 * @param index - user defined indexID
	 * @throws Exception
	 */
	public void indexDocument(String docID, String metadataDoc, String indexID, boolean returnReport) throws Exception;
	
	/**
	 * Removes the document from the index, but not from the document repository
	 * if it exists
	 * @param docID
	 * @param index - user defined indexID
	 * @throws Exception
	 */
	public void removeDocument(String docID, String indexID) throws Exception;

	/**
	 * Returns a string representation of the document identified by
	 * the docID, if a Document Repository exists
	 * @param docID
	 * @return
	 * @throws Exception
	 */
	public String retrieveDocument(String docID) throws Exception;
	
	/**
	 * Returns a list of document IDs of documents added to the specified
	 * index
	 * @param index - user defined indexID
	 * @return
	 * @throws Exception
	 */
	public String[] listDocuments(String indexID) throws Exception;
	
	
	/**
	 * The search query is processed and the matching documents' IDs are
	 * added to the matchingDocIDs list, an XML document is returned
	 * that contains the content of the retrievable fields for
	 * the matching documents. The search operation is performed for the
	 * specified index.
	 * @param queryDoc - search query
	 * @param index - user defined index ID
	 * @return
	 * @throws Exception
	 */
	public  String[] search(String queryDoc, String indexID)
	throws Exception;
	
	/**
	 * Adds the indexing schema document to the index repository
	 * @param indexingSchemaDocument - string representation of user defined
	 * indexing schema document
	 * @throws Exception
	 */
	public void registerIndex(String indexingSchemaDocument)
	throws Exception;
	
	public void removeIndex(String indexID) throws Exception;
	/**
	 * Returns a list of all the index IDs of indexies available in the 
	 * index repository
	 * @return
	 * @throws Exception
	 */
	public String[] getAllRegisteredIndexes() throws Exception;
}
